package com.example.erp.config;

import org.springframework.context.annotation.Configuration;

/**
 * 全局常量
 * */
@Configuration
public class CommonConfig {
    // 菜单类型枚举
    public enum menuType{
        M("目录"),     // 目录
        C("菜单"),     // 菜单
        F("按钮");     // 按钮
        private final String description;
        menuType(String description) {
            this.description = description;
        }
        public String getDescription() {
            return description;
        }
    }
    //接口操作消息提示
    public enum msgTYPE{
        ADD("新增成功!"),
        EDIT("编辑成功!"),
        REMOVE("删除成功!"),
        VIEW("查询成功!"),
        VIEWERROR("查询失败!"),
        ADDERR("新增失败!"),
        EDITERROR("编辑失败!"),
        REMOVEERROR("删除失败!"),
        SUCCESS("操作成功!"),
        ERROR("操作失败!"),
        UPLOAD("上传成功!"),
        EXPORT("导出成功!");

        private final String description;
        msgTYPE(String description) {
            this.description = description;
        }
        public String getDescription() {
            return description;
        }
    }
    // 接口返回消息提示
    public enum resultMsg{
        MENUNAMEQUERY("菜单名称已存在!"),
        ROLENAMEQUERY("角色名称已存在!"),
        USERNAMEQUERY("账号已注册!"),
        LOGINNAMEQUERY("账号不存在!"),
        LOGINPWDQUERY("密码错误!"),
        LOGINCODE("验证码错误!"),
        TOKENERROR("无效令牌!"),
        TOKENNULL("没有令牌!"),
        USERSTATUSERROR("该用户已被禁用!"),
        ROLESTATUSERROR("该角色已被禁用!"),
        ROLEERROR("没有角色权限"),
        GOODSSPECERROR("商品库存不足!,出库失败");

        private final String description;
        resultMsg(String description) {
            this.description = description;
        }
        public String getDescription() {
            return description;
        }
    }
    //全局报错信息处理返回
    public enum errorMsg{
        ERROR("操作失败,请联系管理员!"),
        SQLERROR("数据操作失败,请联系管理员!"),
        SQLKEYERROR("数据重复,操作失败!");

        private final String description;
        errorMsg(String description) {
            this.description = description;
        }
        public String getDescription() {
            return description;
        }
    }
    public enum uploadMsg{
        FILENULL("文件不能为空!"),
        FILENAMENULL("文件名称不能为空!"),
        UPLOADERROR("上传文件失败!"),
        EXPORTERROR("导出文件失败!");

        private final String description;
        uploadMsg(String description) {
            this.description = description;
        }
        public String getDescription() {
            return description;
        }
    }
    public enum compare{
        STATUSZERO(0),
        STATUSONE(1),
        STATUSTWO(2),
        STATUSTHREE(3),
        STATUSFOUR(4),
        STATUSFIVE(5);

        private final Integer description;
        compare(Integer status) {
            this.description = status;
        }
        public Integer getDescription() {
            return description;
        }
    }
    // 订单类型枚举
    public enum OrderType {
        PURCHASE("PO"),       // 采购订单
        SALES("SO"),          // 销售订单
        INBOUND("RK", "TH", "QT"),  // 入库订单
        OUTBOUND("CK", "TH", "QT"); // 出库订单
        private final String[] prefixes;
        OrderType(String... prefixes) {
            this.prefixes = prefixes;
        }
        public String[] getPrefixes() {
            return prefixes;
        }
    }
}
